package com.zhiyou100.service;

import com.zhiyou100.mapper.RoomMapper;
import com.zhiyou100.model.Room;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class RoomService {
    @Autowired
    RoomMapper roomMapper;
    public List<Room> listRoom(Map map) {
        List<Room> rooms =  roomMapper.listRoom(map);
        return rooms;

    }

    public int addRoom(Room room) {
       int  i  =  roomMapper.addRoom(room);
       return i;
    }

    public int updateRoom(Room room) {
        int  i  =  roomMapper.updateRoom(room);
        return i;
    }

    public Room lookRoom(int id) {
        Room Room =  roomMapper.lookRoom(id);
        return Room;
    }

    public int deleteAll(List<Integer> roomIds) {
      int i =   roomMapper.deleteAll(roomIds);
      return i;
    }

    public int delete(int id) {
       int i =  roomMapper.delete(id);
       return  i;
    }
    public List<Room> findRoomByType(String type){
        List<Room> rooms =  roomMapper.findRoomByType(type);
        return  rooms;
    }


    public int updateRoomStatus2(int rid) {
        int i =   roomMapper.updateRoomStatus2(rid);
        return i;
    }

    public int updateRoomStatus(Integer roomid, String starttime, String endtime) {
        int i =   roomMapper.updateRoomStatus( roomid,  starttime,  endtime);
        return i;
    }
}
